import Fetch, { buildURL } from './fetch';

/*********************teaching h5 new api*********************/
let env = 'dev'; //测试用开发环境，生产环境下不起作用， mock , dev 切换环境后重启服务
/**
 * 获取考试列表
 * @returns
 */
export const GetpaperList = (params) => {
  return Fetch(buildURL('paper', env), params, 'GET');
};
/**
 * 获取等待考试列表
 * @returns
 */
export const GetPaperWait = () => {
  return Fetch(buildURL('paper/wait', env), {}, 'GET');
};

/**
 * 获取考试统计
 * @returns
 */
export const GetPaperStatistics = () => {
  return Fetch(buildURL('paper/statistics', env), {}, 'GET');
};
/**
 * 获取考试结果
 * @returns
 */
export const GetPaperResult = (id) => {
  return Fetch(buildURL(`paper/${id}/result`, env), {}, 'GET');
};
/**
 * 提交考试
 * @returns
 */
export const SubmitPaper = (id, params) => {
  return Fetch(buildURL(`paper/${id}`, env), params, 'POST');
};

/**
 * 获取考试详情
 * @returns
 */
export const GetPaper = (id) => {
  return Fetch(buildURL(`paper/${id}`, env), {}, 'GET');
};
/**
 * 考试选项
 * @returns
 */
export const GetPaperOption = (params) => {
  return Fetch(buildURL(`paper/option`, env), params, 'GET');
};

/**
 * 作业列表
 * @returns
 */
export const GetMyWorkLst = (params) => {
  return Fetch(buildURL('work', env), params, 'GET');
};
/**
 * 提交作业
 * @returns
 */
export const CommitWork = (id, params) => {
  return Fetch(buildURL(`work/${id}`, env), params, 'POST');
};
/**
 * 作业详情
 * @returns
 */
export const GetWorkDetail = (id, params) => {
  return Fetch(buildURL(`work/${id}`, env), params, 'GET');
};
/**
 * 作业结果 work/{id}/result
 * @returns
 */
export const GetWorkResult = (id, params) => {
  return Fetch(buildURL(`work/${id}/result`, env), params, 'GET');
};

/**
 * 获取问卷列表
 */
export const GetSurveyList = (params) => {
  return Fetch(buildURL(`questionnaire/app`, env), params, 'GET');
};

/**
 * 提交问卷调查
 */
export const SubmitSurvey = (id, params) => {
  return Fetch(buildURL(`questionnaire/app/${id}/submit`, env), params, 'POST');
};
/**
 * 获取调查详情
 * @param  id
 * @returns
 */
export const GetSurveyDetail = (id) => {
  return Fetch(buildURL(`questionnaire/app/${id}`, env), {}, 'GET');
};
/**
 * 获取课堂训练详情
 * @param {*} id
 * @returns
 */
export const GetTrainDetail = (id) => {
  return Fetch(buildURL(`course-resource/train/${id}`, env), {}, 'GET');
};

/**
 * 学习课堂训练
 * @returns
 */
export const LearnTrain = (id) => {
  return Fetch(buildURL(`course-resource/${id}/learn`, env), {}, 'POST');
};

/*********************teaching h5 new api*********************/
